#include <stdio.h>
#include <string.h>

void quicksort(char* arr, int left, int right) 
{    
    if (left >= right) 
        return;    
    
    int i = left, j = right;    
    char pivot = arr[(left + right) / 2];    

    while (i <= j) 
    {        
        while (arr[i] > pivot) 
            i++;        
        
        while (arr[j] < pivot) 
            j--;        
        
        if (i <= j) 
        {            
            char temp = arr[i];            
            arr[i] = arr[j];            
            arr[j] = temp;            
            i++;            
            j--;        
        }    
    }    
    quicksort(arr, left, j);    
    quicksort(arr, i, right);
}

int main() 
{    
    char str[20];    
    printf("请输入一个字符串：");    
    scanf("%s", str);    
    quicksort(str, 0, strlen(str) - 1);    
    printf("降序排列后的字符串为：%s\n", str); 

    return 0;
}
